package review.generate;

import org.springframework.util.StringUtils;

import lombok.Data;

@Data
public class PropertyBean {
  private String name;
  private String columnName;
  private String columnDefinition;
  private String type;
  private String descript;
  private boolean notnull = false;
  private String[] enums;

  public void set(String key, String value) {
    if (key.equals("propertyName")) {
      name = value;
    } else if (key.equals("column")) {
      columnName = value;
    } else if (key.equals("columnDefinition")) {
      columnDefinition = value;
    } else if (key.equals("type")) {
      type = value;
    } else if (key.equals("descript")) {
      descript = value;
    } else if (key.equals("notnull")) {
      notnull = value.equalsIgnoreCase("true");
    } else if (key.equals("enum")) {
      if (StringUtils.hasText(value)) {
        enums = value.split(",");
      }
    }
  }
}